<?php
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();

#get the invoice id
$product_id = $_GET['id'];

$product = getProduct($product_id);

#get custom field labels
$customFieldLabel = getCustomFieldLabels();
$taxes = getActiveTaxes();
$tax_selected = getTaxRate($product['default_tax_id']);
$fraccionable = [$LANG["no"]=> $LANG["no"], $LANG["yes"]=>$LANG["yes"]];

$smarty -> assign("defaults",getSystemDefaults());
$smarty -> assign('product',$product);
$smarty -> assign('taxes',$taxes);
$smarty -> assign('tax_selected',$tax_selected);
$smarty -> assign('customFieldLabel',$customFieldLabel);
$smarty -> assign('fraccionables',$fraccionable);
$smarty -> assign('isFrac',$LANG["no"]);
//SI EL PRODUCTO ES FRACCIONABLE ENTONCES CARGAR LOS RANGOS DE PRECIOS
if(isset($product["custom_field2"]) && $product["custom_field2"] == $LANG["yes"]){
    $smarty -> assign('isFrac',$LANG["yes"]);
    $rangePrices = getRangePrices($product_id);
    $smarty -> assign ('rangePrices',$rangePrices);
    $smarty->assign('unitsByProduct',$product['unitsByProduct']);
}

$smarty -> assign('pageActive', 'product_manage');
$subPageActive = $_GET['action'] =="view"  ? "product_view" : "product_edit" ;
$smarty -> assign('subPageActive', $subPageActive);
$smarty -> assign('active_tab', '#product');


?>
